home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / prnf246.zip / COUNTPGS.DOC < prev    next >
Text File  |  1993-12-29  |  11KB  |  202 lines

  1.  
  2. ________COUNTPGS                                                          Ver. 3.53
  3.  
  4.  
  5.  
  6. Purpose: Examines ASCII text files.  Before you print, find out how many
  7.          pages, how wide the lines and margins (if any), whether there are
  8.          any ragged ends, bare carriage returns, tabs, high-bit charac-
  9.          ters,^Z (end of file) characters in the wrong place, or oversize
  10.          pages.
  11.  
  12.  
  13. Format:     COUNTPGS [[d:][path]filename.ext ...] [/Option[/Option]...]
  14.  
  15.          __                      ____                      ____________         d: is the drive letter, path is the DOS path, and filename.ext may
  16.          contain DOS's usual wildcards (* and ?).  Omit filenames &
  17.          options, and they'll be asked for.  These are your options:
  18.  
  19.                                        _            /Lnn assume paper size: nn Lines/page (default is 66).
  20.  
  21.                         _            /Tnn assume Tab stops every nn columns (default is 8).
  22.  
  23.                                             _            /P echo CountPgs' report to the Printer.
  24.  
  25.                                         _            /F echo CountPgs' report to File.  By default, it goes to
  26.                COUNTPGS.LST, but /F:filespec sends it where you like.  You
  27.                can specify the whole thing; e.g.: /F:C:\TEMP\FILESIZE.LST
  28.  
  29.                  _            /V ("Verbose") Show, page by page (counting by formfeeds),
  30.                number & width of the lines and size of any left margin.
  31.  
  32.                  _            /C ("Compact verbose") List just the lines/page for each page
  33.                (counting by FF's), crammed 20/line.
  34.  
  35. Remarks: CountPgs can handle 25 filenames, which may contain wildcards.
  36.          Each must have its own drive and path designations.  Thus:
  37.  
  38.             COUNTPGS B:XYZ.TXT
  39.  
  40.             COUNTPGS B:\*.DOC /V/T5
  41.  
  42.             COUNTPGS B:ABCD.TXT C:\XYZ*.DOC C:\FOO\AB??.* /P /L55
  43.  
  44.          Or, enter just COUNTPGS.  It'll show you what to do.
  45.  
  46.          Most printers will feed out the rest of the page when they encoun-
  47.          ter a "form-feed" character, ASCII #12.  (On the screen, it shows
  48.          up as either ^L or the Venus (female) sign.)  Some files use form-
  49.          feed characters to divide pages; some just feed out the proper
  50.          number of lines per page.  If there are any FF's at all, the num-
  51.          ber of FF's should (but may not) be the number of pages.  When
  52.          there are no form-feeds, CountPgs calculates the number of pages
  53.          from the line count.
  54.  
  55.          It counts lines by line-feeds rather than carriage returns, so it
  56.          isn't put off by files that use CR's to make underlining, &c.  Its
  57.          line width allows for CR's, Tabs, and back-space characters, but
  58.          it won't keep up with sophisticated print-control characters or
  59.          embedded word-processor codes.
  60. ________COUNTPGS 3.53                                                        Page 2
  61.  
  62.  
  63.  
  64.                        On The Pathology of Text Files
  65.                      (and what CountPgs can do about it)
  66.  
  67.   To find out how much paper to lay out, I once looked at the end of a file
  68.   and found page 1105.  Refusing to believe it, I wrote CountPgs.  That
  69.   page turned out to be p. 5 of Chap. 11, of course, and the whole thing
  70.   ran about 100 pages.  Whew!  In its present form, CountPgs gives several
  71.   other kinds of information.  We've all seen DOC files with bungled pagin-
  72.   ation.  CountPgs can point you to making repairs before wasting paper.
  73.   It can help with at least eight kinds of trouble:
  74.  
  75.    1. It will indicate files with ragged ends --that end in the middle of a
  76.       page.  This happens when there are lines after the last FF.  A file
  77.       without FF's has a ragged end if the pages don't come out even.  If
  78.                                        ____      the file ends in the middle of a line (has characters after the last
  79.       FF or LF), CountPgs will call it "cut off."  You can COPY PRN a rag-
  80.       ged or cut off file, but before you COPY PRN a bunch of them, you'll
  81.       have to do something clever.
  82.  
  83.       A file with a ragged end and no FF's may not be paged at all.  It may
  84.       be meant for the screen; it may be a thoughtless scrawl.  On the
  85.       other hand, a "ragged end" one line long, is probably just a CR/LF
  86.       after the FF (some editors put that in automatically).  If the look
  87.       of your printout matters, look at the file before you print.  To pag-
  88.       inate it properly, you may want to overhaul it with Mangler and Pa-
  89.       gina or pull it into your word-processor.
  90.  
  91.    2. On the other hand, make sure your word-processor won't make trouble
  92.       of its own.  CountPgs tells you whether the file uses bare carriage
  93.       returns (CR's without LF's) because such a file has to be handled
  94.       carefully.  Some editors read characters until they find a CR, assume
  95.       that's the end of the line and start another line at that point.  If
  96.       the file was using CR to go back and add underlining, you'll now have
  97.       two lines, one with the words and one with the underlines.  Try to
  98.       fix it in such an editor, and you might get one long line with words
  99.       on one end and underlines on the other.  If CountPgs tells you a file
  100.       has CR's, check your word-processor before you pull it in.
  101.  
  102.    3. FF's may be wrongly placed.  Occasionally, a page will have more than
  103.       a pageful of lines between FF's.  CountPgs will say something like
  104.       "4? 5? pages."  The smaller is the number of FF's, but the printout
  105.       will actually take 5 pages.  Most likely, 4 were intended, but some-
  106.       body bungled.  Before you print out such a file, you may want to fix
  107.       it up.  CountPgs will indicate which pages are oversize.  The /V op-
  108.       tion will list the lengths of every page --presuming they're paged
  109.       with FF's.  If there are no FF's, /V will have nothing to say.
  110.  
  111.                                    ____________      If the /V option shows pages consistently oversized, they may be laid
  112.       out for longer pages.  If you can set your printer for different line
  113.       spacings, try other /L settings to find something suitable.  Con-
  114.       versely, if CountPgs comes up with something like "1? 5? pages, most
  115.       likely there's a stray FF at the end of a file that wasn't supposed
  116.       to have any --either paged by counting lines or not paged at all.
  117.       Occasionally, an otherwise harmless librarian will leave a lone FF at
  118.       the end of his little addendum.
  119. ________COUNTPGS 3.53                                                        Page 3
  120.  
  121.  
  122.    4. Lines may be too long for the printer.  When a line is too long, it
  123.       folds.  You get two lines of print, but the computer counts it as
  124.       one, so pages can slop over at the end.  Forewarned (by CountPgs),
  125.       you can use smaller type to keep the lines straight.  Conceivably,
  126.       you might manage it with smaller tab widths.
  127.  
  128.    5. Sometimes, a left margin is built into the file.  CountPgs will show
  129.                           ________      you the size of the smallest sequence of blanks at the beginning of
  130.       the line (except for lines which have no print on them at all).  A
  131.       check with the /V option can show an occasional odd page which might
  132.       be fixed.  A regular alternation of margin size, especially an alter-
  133.       nation of 0 with something else, may indicate a file meant to be
  134.       printed on both sides of the paper.  Check the page headers; you may
  135.       need a program like Prn2Both to take the file apart.
  136.  
  137.    6. CountPgs will report whether a file contains high-bit characters,
  138.       that is characters with ASCII numbers greater than 127.  Usually,
  139.       these are printer graphics characters.  If your printer can produce
  140.       them, you should make sure it's set to do so when you print such a
  141.       file.  It is just possible, however, that the high bit characters
  142.       aren't meant as graphics.  Many printers will produce italics for
  143.       these characters.  If you don't want a false start, you'd better look
  144.       at the file.
  145.  
  146.    7. Some programs mark the end of a file on disk with an "end of file"
  147.       character (^Z, ASCII 26).  CP/M worked this way, and the technique
  148.       was carried over to DOS.  Since DOS keeps a record of the number of
  149.       bytes in the file, however, a program can use that number to find the
  150.       end of the file instead of looking for a ^Z end marker.  If a number-
  151.       of-bytes program copies a ^Z-marked file, it will probably copy the
  152.       ^Z, too.  Combine several files that way, and you'll have false ^Z
  153.       end-of-file markers in your text.  (Some versions of PrnSet used to
  154.       make this mistake.)  Some programs will load it wrong or bobtail it
  155.       at the ^Z.  To fix the file, remove all the ^Z's in it with Mangler's
  156.       "DelRep" (delete/replace) function.
  157.  
  158.       On the other hand, a ^Z-marked file read by a number-of-bytes program
  159.       may falsely appear to have text beyond the ^Z.  (LIST will do that
  160.       sometimes.)  In that case, you want to truncate the file at the ^Z,
  161.       that is, convince DOS to change its file length record.  DOS will do
  162.       this for you with the /A switch on the COPY command:
  163.  
  164.          COPY filename.old /A filename.new
  165.  
  166.       will truncate the file at the first ^Z.
  167.  
  168.       Which to do?  You'd better look at the file with LIST or some other
  169.       file display.  Your word processor may or may not refuse to read past
  170.       the first ^Z it comes to.
  171.  
  172.    8. Finally, some files begin with an irritating FF to make a guard
  173.       sheet.  CountPgs will point this out.  If terminal FF's also irritate
  174.       you, use the Verbose option and watch for a last page with 1 or 0
  175.       lines.
  176. ________COUNTPGS 3.53                                                        Page 4
  177.  
  178.  
  179. Version History (belated):
  180.  
  181.    3.23 (Aug 1989) total line and character counts.
  182.    3.30 (Oct 1989) Longest line count for FF'd files.
  183.    3.31 (Dec 1989) fix bug in longest line count w oversize pages.
  184.    3.32 ( "    " ) report whether file uses tabs.
  185.    3.40 ( "    " ) report ^Z in text.
  186.    3.50 (Feb 1990) report high-bit characters in text.  Better stop-
  187.            ping on <Esc> or Ctrl-C.
  188.    3.51 (Apr 1990) report "cut off" instead of "ragged" when ends in
  189.            middle of a line.  (CR, BS or EoF apart, any character
  190.            after the last LF or FF makes it "cut off.")  .51a (8/91)
  191.            can count more than 32K lines.
  192.    3.52 (Oct 1992) Bug in TP6: reset balks at non-text read-only files.
  193.            Works around by using text files or changing attribute temp-
  194.            orarily. .52a (11/92): bugfix for files with more than 999
  195.            lines.  .52b reads read-only files the right way --no need
  196.            to fiddle with attributes.  .52c (1/93) can print what .51a
  197.            could count.
  198.    3.53 (Dec 1993) Put the /F report file anywhere you like.
  199.  
  200.                                             ---R. N. Wisan,  December, 1993
  201.                                            37 Clinton St, Oneonta, NY 13820
  202.                                               internet: wisanr@hartwick.edu